import service from "../utils/request";
import {queryKey} from '../utils'

export function createVmList(data:any) {
  return service.post(`/vm`, data);
}
export function editVmList(id:number,data:any) {
  return service.put(`/vm/${id}`,data);
}
export function deleteVmList(id:number) {
  return service.delete(`/vm/${id}`);
}
export function getVmListDetail(id:number) {
  return service.get(`/vm/${id}`);
}
export function enable(id:number) {
  return service.put(`/vm/${id}/enable`);
}
export function sync(id:number) {
  return service.put(`/vm/${id}/sync`);
}
//  云主机列表
export function getVmList(params:any) {
  const other = queryKey()
  return service.get(`/vm`, { params:{...params, ...other} });
}
//  重启
export function restartVm(params:any,id:number) {
  return service.get(`/vm/${id}/vm`, { params });
}
//  销毁
export function destroyVm(params:any,id:number) {
  return service.get(`/vm/${id}/vm`, { params });
}
//  创建快照
export function createSnapshot(params:any,id:number) {
  return service.get(`/vm/${id}/vm`, { params });
}
//  磁盘扩容
export function diskExpansion(params:any,id:number) {
  return service.get(`/vm/${id}/vm`, { params });
}
//  添加磁盘
export function AddDisk(params:any,id:number) {
  return service.get(`/vm/${id}/vm`, { params });
}